//
//  UIButton+Extension.swift
//  新浪微博
//
//  Created by Lembo on 16/2/23.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

extension UIButton {
    // 给UIButton扩展 构造一个函数
    // 背景图片 + 图片
    convenience init(backImageName: String, imageName: String) {
        self.init()
        setBackgroundImage(UIImage(named: backImageName), forState: .Normal)
        setImage(UIImage(named: imageName), forState: .Normal)
        
        // 设置高亮
        setBackgroundImage(UIImage(named: backImageName + ""), forState: .Highlighted)
        setImage(UIImage(named: imageName + ""), forState: .Highlighted)
    }
    // 背景图片 + 文案
    convenience init(backImageName:String, title: String, textColor: UIColor) {
        self.init()
        setBackgroundImage(UIImage(named: backImageName), forState: .Normal)
        setTitle(title, forState: .Normal)
        setTitleColor(textColor, forState: .Normal)
    }
}